
/**
 * 
 * @param sW 宽比例
 * @param sY 高比例
 * @param width 宽度
 * @param height 高度
 */
export const getMaxRectFN = (
    sW:number, 
    sH:number,
    sourceWidth:number, 
    sourceHeight:number
) => {
    return new Promise<{width:number; height: number}>((resolve) => {

        let width = 0;
        let height = 0;
        height = 100;

        const stepW = sourceWidth / sW;
        const stepH = sourceHeight / sH;
        if(stepW > stepH){
            width = stepH * sW;
            height = stepH * sH;
        }else if(stepW < stepH){
            width = stepW * sW;
            height = stepW * sH;
        }

        resolve({ width: width, height: height });
    });
};
